<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class TestCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:test1';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $this->catlog();dd();
        $this->login();dd();
        $timestamp = time();
        $key = env('API_KEY');
        $mobile = '13253411751';
        $params = compact('timestamp','key','mobile');
        ksort($params);
        $newSign = createSign($params);
        $params['sign'] = $newSign;
        unset($params['key']);
        dump($params);
    }

    public function regist()
    {
        $timestamp = time();
        $key = env('API_KEY');
        $mobile = '13253411751';
        $code = '68461';
        $params = compact('timestamp','key','mobile','code');
        ksort($params);
        $newSign = createSign($params);
        $params['sign'] = $newSign;
        unset($params['key']);
        dump($params);
    }


    public function login()
    {
        $timestamp = time();
        $key = env('API_KEY');
        $mobile = '13253411751';
        $code = '3196';
        $params = compact('timestamp','key','mobile','code');
        ksort($params);
        $newSign = createSign($params);
        $params['sign'] = $newSign;
        unset($params['key']);
        dump($params);
    }

    public function catlog()
    {
        $timestamp = time();
        $key = env('API_KEY');
        $uid = '1';
        $params = compact('timestamp','key','uid');
        ksort($params);
        $newSign = createSign($params);
        $params['sign'] = $newSign;
        unset($params['key']);
        dump($params);
    }

    public function payh5()
    {
        $timestamp = time();
        $key = env('API_KEY');
        $uid = '1';
        $params = compact('timestamp','key','uid');
        ksort($params);
        $newSign = createSign($params);
        $params['sign'] = $newSign;
        unset($params['key']);
        dump($params);
    }
}
